﻿<?php
	// session_start();
	
	if (!isset($_SESSION["taikhoan"]))
	{
		header("Location: ad-dangnhap.php");
	}
	
	include "connect.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<form name="f" method="post" action="" onsubmit="">
			<table width="400" align="center" border="0" style="border:1px solid #0066FF" cellspacing="0">
						
					  <tr> 
							<td height="30" colspan="2" align="center" bordercolor="#FFFFFF" background="image/bg_header.gif">
								<span style="font-size:24px; color:#FFFFFF; font-weight:bold;">Thêm Bộ Môn mới</span></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="15" width="200" colspan="2"></td>
						 
					  </tr>
						
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px" width="200">Mã Bộ Môn:</td>
						 <td align="left"><input type="text" name="mabm" /></td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Tên Bộ Môn:</td>
						 <td align="left"><input type="text" name="tenbm" /></td>
					  </tr>
					  
					   <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="30" style="font-size:18px">Tên Khoa:</td>
						 <td align="left">
							 <select name="khoa">
							                                    <?php
																		$sql=mysql_query("select * from khoa"); 
																		while($r=mysql_fetch_row($sql))
																		{
																			  $makhoa=$r[0];
																			  $tenkhoa=$r[1];
																?>
																 <option value=" <?php echo $makhoa; ?>"><?php echo  $tenkhoa; ?></option>
																<?php 
																		}
													
																?>
																 <option value="" selected="selected">- Chọn Khoa - </option>
							 </select>
						 </td>
					  </tr>
					  
					  <tr bordercolor="#FFFFFF" align="center"> 
						  <td  height="15"  colspan="2"></td>
						 
					  </tr>
					  
					  <tr bordercolor="#FFFFFF">
						  <td  align="right" height="30"><input type="submit" value="Lưu Lại" name="luu" /></td>
						  <td align="center"><input type="reset" value="Làm Lại" name="huy" /></td>
					 </tr>
					
			</table>
</form>
<?php
           if(isset($_POST["luu"]))
				{
				          $mbm = $_POST["mabm"];
				          $ten = $_POST["tenbm"];
						  $mak = $_POST["khoa"];
						  
						  $kq = mysql_query("insert into `bo mon` values('$mbm', '$ten', '$mak' )");
						  echo"<script type='text/javascript'>alert('Them Thanh Cong')</script>";
		                  echo'<meta http-equiv="refresh" content="0;URL=ad-trangchu.php?nav=bomon">';
						  
				}
 ?>		

</body>
</html>
